home *** CD-ROM | disk | FTP | other *** search
- /* (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
- *
- * Redistribution and use in source and binary forms are permitted for
- * non-commercial use, provided that the above copyright notice and this
- * paragraph are duplicated in all such forms. THIS SOFTWARE IS PROVIDED
- * ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
- #include <stdio.h>
- #include <dir.h>
- #include "screen.h"
-
- mk_start(fnm)
- unsigned char fnm[];
- {
- FILE *start;
- unsigned char buf[128], drive[MAXDRIVE], dir[MAXDIR], fname[MAXFILE];
- unsigned char ext[MAXEXT], tmp_path[128], root_dir[128];
- int n, m, stat;
-
- sprintf(buf, "%s\\bin\\%s", path, fnm);
- if (debug)
- {
- printf("***> startnos.bat file (%s):\n", buf);
- start = stdout;
- }
- else
- {
- if ( (start = fopen(buf, "w")) == NULL )
- {
- printf("\nCan't open \"%s\" for write, aborting!\n\n", buf);
- exit(-1);
- }
- }
-
- fprintf(start, "echo off\n");
- stat = fnsplit(path, drive, dir, fname, ext);
- fprintf(start, "%s\n", drive);
- if ( (stat & DIRECTORY) || (stat & FILENAME) )
- fprintf(start, "cd %s%s\n", dir, fname);
- else
- fprintf(start, "cd \\ \n", dir, fname);
-
- fprintf(start, "set TZ=%s0\n", timezone);
- fprintf(start, "del %s\\spool\\mqueue\\*.lck\n", path);
- fprintf(start, "del %s\\spool\\mail\\*.lck\n", path);
- fprintf(start, "del nos_old.log\n");
- fprintf(start, "ren nos.log nos_old.log\n");
-
- strcpy(tmp_path, path);
- m = strlen(tmp_path);
- for (n = 0; n < m; n++)
- if (tmp_path[n] == '\\')
- tmp_path[n] = '/';
- n = fnsplit(tmp_path, drive, dir, fname, ext);
- strcpy(root_dir, dir);
- strcat(root_dir, fname);
- if (strlen(root_dir) < 1)
- strcpy(root_dir, "/");
-
- if (ka9q && !g1emm)
- fprintf(start, "bin\\noska9q -d %s %s%s/ka9q.net\n",
- root_dir, dir, fname);
- if (!ka9q && g1emm)
- fprintf(start, "bin\\nosg1emm -d %s %s%s/g1emm.net\n",
- root_dir, dir, fname);
- if (ka9q && g1emm)
- {
- fprintf(start, "if %c1X==X goto ka9q\n", 37);
- fprintf(start, "if %c1X==ka9qX goto ka9q\n", 37);
- fprintf(start, "if %c1X==KA9QX goto ka9q\n", 37);
- fprintf(start, "if %c1X==g1emmX goto g1emm\n", 37);
- fprintf(start, "if %c1X==G1EMMX goto g1emm\n", 37);
- fprintf(start, "echo Usage: \%0 [ka9q | g1emm]\n");
- fprintf(start, "goto end\n");
- fprintf(start, ":ka9q\n");
- fprintf(start, "bin\\noska9q -d %s %s%s/ka9q.net\n",
- root_dir, dir, fname);
- fprintf(start, "goto end\n");
- fprintf(start, ":g1emm\n");
- fprintf(start, "bin\\nosg1emm -d %s %s%s/g1emm.net\n",
- root_dir, dir, fname);
- fprintf(start, ":end\n");
- }
-
- if (!debug)
- fclose(start);
- }
-